<template>
	<view class="indexBox">
		<u-sticky bgColor="#fff">
		    <u-tabs :list="tabsList" :scrollable="false" :current="current" @change="currentChange"></u-tabs>
		</u-sticky>
		<!-- 内容1 表单内容 -->
		<view class="" v-show="current == 0">
			<leaveClearFrom :processId="processId" :propFromData="fromData" />
		</view>
		<processDetial v-show="current == 1" :processId="processId" :approvalInfo="approvalInfo" @init="initFun" />
	</view>
</template>

<script>
	import leaveClearFrom from '@/pages/process/leaveclear/create.vue'
	import processDetial from '@/pages/process/processDetial.vue'
	import {getApprovalDetail,approveTask,rejectTask,getTaskListByProcessInstanceId} from '@/api/oa/common.js'
	import {getOaLeaveClear} from '@/api/oa/leaveclear/index.js'
	export default {
		components:{
			leaveClearFrom,
			processDetial
		},
		data() {
			return {
				// tabs选中
				current:0,
				tabsList: [{
					name: '详情',
				}, {
					name: '流转',
				}],
				// 流程id
				processId:'',
				// 审批信息详情
				approvalInfo:{},
				// 表单信息
				fromData:{},
				
				
				
				
			};
		},
		methods:{
			currentChange(val){
				this.current = val.index;
			},
			// 根据流程id获取表单内容
			async getFromData(){
				let fromData=  await getOaLeaveClear({
					id:this.approvalInfo.processInstance.businessKey
				});
				this.fromData = fromData.data;
				console.log(this.fromData)
			},
			async initFun(){
				let info = await getApprovalDetail({
					processInstanceId:this.processId
				});
				this.approvalInfo = info.data;
				// 获取表单信息
				this.getFromData()
				// this.getBz()
			}
		},
		async onLoad(option) {
			// 获取审批详情
			this.processId = option.id;
			this.initFun()
		}
	}
</script>

<style lang="less" scoped>
	
</style>